Modern microprocessors employ various prediction techniques to improve their performance. For example, branch predictors predict whether branch instructions will be taken or not taken and, if taken, predict the target address of the branch instruction. Dynamic branch predictors accumulate a history of outcomes of different branch instruction executions and make their predictions based on the history. The prediction accuracy of a dynamic branch predictor is largely a function of the amount of history it is capable of accumulating. As long as the set of branch instructions that are being executed by a program within a given time is small enough to be contained within the prediction history, the accuracy may be very high.
However, the prediction accuracy may be greatly diminished by certain events. One such event is when the currently running program is interrupted temporarily while another program runs. For example, a packet may be received by a network interface controller, which signals an interrupt to the processor. The processor transfers control to the operating system to service the interrupt, which temporarily suspends the currently running program A until the operating system returns control back to running program A. While the processor is executing branch instructions of the operating system, it is polluting the prediction history in the branch predictor for program A. This is likely to diminish the accuracy of the branch predictor for predicting branches of program A.